package ae.pcfc.cldos.online.web.controller.base;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import ae.pcfc.cldos.online.web.ViewPath;

@Controller
public class IndexPageController extends BaseController {

	@RequestMapping(value="/")
	public ModelAndView base() {
		return new  ModelAndView(ViewPath.__FORWARD+ViewPath.__INDEX);
	}
	
	@RequestMapping( value = ViewPath.__INDEX)
	public ModelAndView process() {
		if(securityService.isCompanyAdmin() || securityService.isCompanyEmployee()){
			return new ModelAndView(ViewPath.__REDIRECT+"client/company/home/show.htm");
		} else if (securityService.isGeneralAdmin()) {
			return new ModelAndView(ViewPath.__REDIRECT+ViewPath.__TKSADMIN_HOME+"/show.htm");
		}
		return null;
	}
}
